package com.area.yunzhijia.controller;

import com.area.yunzhijia.AESEncryptor;
import org.springframework.http.HttpEntity;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;

@RestController
@RequestMapping(value = "/test",produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public class YunzhijiaController {

    @PostMapping
    public HttpEntity getData(@RequestBody String requestBody,
                              HttpServletRequest request){
        System.out.println(request.getContentType()+"-----------contentType");
        System.out.println(String.valueOf(requestBody));
        AESEncryptor aesEncryptor = new AESEncryptor("wTbspvzfiBUGV9L1");
        String json = aesEncryptor.decrypt(requestBody);
        System.out.println("json--------------");
        System.out.println(json);
        System.out.println("--------------------------------------------------------------");
        return ResponseEntity.ok().build();
    }

}
